package net.wsfcp.android.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

//fragment+viewpager
public class FragmentAdapter extends FragmentPagerAdapter {
    private List<Fragment> mFragment = new ArrayList<>();

    public List<Fragment> getmFragment() {
        return mFragment;
    }

    public void setmFragment(List<Fragment> mFragment) {
        this.mFragment = mFragment;
        notifyDataSetChanged();
    }

    public FragmentAdapter(FragmentManager fm) {//这是一个内部类
        super(fm);

    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        fragment = mFragment.get(position);
        return fragment;
    }

    @Override
    public int getCount() {
        return mFragment.size();
    }
}

